home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / UUPC3 / MAC_SPEC / UNIX_LIB / NDIR.H < prev    next >
Text File  |  1989-10-22  |  1KB  |  55 lines

  1. /* @(#)ndir.h    1.4    4/16/85 */
  2. #define _H_ndir
  3.  
  4. #ifndef DEV_BSIZE
  5. #define    DEV_BSIZE    512
  6. #endif
  7. #define DIRBLKSIZ    DEV_BSIZE
  8. #define    MAXNAMLEN    255
  9.  
  10. struct    direct {
  11.     long    d_ino;            /* inode number of entry */
  12.     short    d_reclen;        /* length of this record */ 
  13.     short    d_namlen;        /* length of string in d_name */
  14.     char    d_name[MAXNAMLEN + 1];    /* name must be no longer than this */
  15. };
  16.  
  17. /*
  18.  * The DIRSIZ macro gives the minimum record length which will hold
  19.  * the directory entry.  This requires the amount of space in struct direct
  20.  * without the d_name field, plus enough space for the name with a terminating
  21.  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  22.  */
  23.  
  24. #ifdef DIRSIZ
  25. #undef DIRSIZ
  26. #endif /* DIRSIZ */
  27. #define DIRSIZ(dp) \
  28.     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
  29.  
  30. /*
  31.  * Definitions for library routines operating on directories.
  32.  */
  33. /*
  34. typedef struct _dirdesc {
  35.     int    dd_fd;
  36.     long    dd_loc;
  37.     long    dd_size;
  38.     char    dd_buf[DIRBLKSIZ];
  39. } DIR;
  40. */
  41. typedef struct _dirdesc {
  42.     int     ioVRefNum;
  43.     long    ioDrDirID;
  44.     int        ioFDirIndex;
  45.     int        currdir;
  46. } DIR;
  47. #ifndef NULL
  48. #define NULL 0L
  49. #endif
  50. extern    DIR *opendir();
  51. extern    struct direct *readdir();
  52. extern    void closedir();
  53. extern char * getcwd();
  54.  
  55.